package com.atlbb.config;

/**
 * @author LiangQingBin
 * @version 1.00
 * @ClassName ManagerWebConfig
 * @Description TODO
 * @time 2021/11/11 20:14
 */

import com.atlbb.interceptor.LoginInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * 1.编写一个拦截器实现HandlerInterceptor
 * 2.拦截器注册到容器中
 * 3.指定拦截规则，如果是拦截所有，静态资源也会拦截，要注意放行
 */
@Configuration(proxyBeanMethods = true)
public class ManagerWebConfig implements WebMvcConfigurer {
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new LoginInterceptor()).addPathPatterns("/**").excludePathPatterns("/","/login","/css/**","/unLogin");
        
    }
}
